
package cn.ljx.Controller;

import cn.ljx.Service.UserService;
import cn.ljx.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by dell on 2018/12/29.
 */
@Controller
public class Login {
//    ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext-service.xml");
//    UserService providerService = (UserService) ctx.getBean("userService");


        @Resource
        private UserService userService;

        @RequestMapping("/all")
        public  String allserect(@RequestParam(value="user",required=false)
                                         User user, Model model,
        @RequestParam(value="b",required=false) Integer B,@RequestParam(value = "bookName",required = false) String booname
        ){

        if(B==null){
            B=0;
        }
       List<User> a=userService.whereSelect(B,booname);

         model.addAttribute("book",a);
        return  "index";





    }
}
